package blue.mqtt4j.internal.client.handler;

import blue.mqtt4j.internal.client.net.NettyClient;
import io.netty.channel.Channel;
import io.netty.handler.codec.mqtt.MqttSubAckMessage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author Jin Zheng
 * @since 1.0 2020-10-19
 */
public class SubAckMessageHandler implements MessageHandler<MqttSubAckMessage>
{
	private static Logger logger = LoggerFactory.getLogger(SubAckMessageHandler.class);

	private final NettyClient client;

	public SubAckMessageHandler(NettyClient client)
	{
		this.client = client;
	}

	@Override
	public void handle(MqttSubAckMessage message, Channel channel)
	{
		int messageId = message.variableHeader().messageId();
		client.subAck(messageId);
	}
}
